package com.IO.IODemo02;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

public class A02BianJieMa {
    public static void main(String[] args) throws UnsupportedEncodingException {
        // 1.编码
        String str = "ai你呦";
        byte[] bytes1 = str.getBytes(); // utf-8
        System.out.println(Arrays.toString(bytes1));
        byte[] bytes2 = str.getBytes("GBK");
        System.out.println(Arrays.toString(bytes2));
        
        // 解码
        String s = new String(bytes1);
        System.out.println(s);
        String s1 = new String(bytes2, "GBK");
        System.out.println(s1);
    }
}
